<?php
// register wordpress custom menus
function register_menus() {
register_nav_menus(
array(
'primary-menu' => __('Primary Menu')
)
)
;
}
add_action('init', 'register_menus');
// add theme support for:
// ...featured image (post thumbnails)
if (function_exists('add_theme_support')) { add_theme_support('post-thumbnails'); }
// Set the image sizes for post thumbnails
if (function_exists('add_image_size')) {
add_image_size('package-thumb', 190, 140, true);
add_image_size('package-full', 630, 210, true);
add_image_size('blog-thumb', 130, 110, true);
add_image_size('blog-full', 630, 210, true);
add_image_size('specials-full', 630, 210, true);
add_image_size('accommodation-full', 630, 210, true);
}
// dynamic header & sidebar
if (function_exists('register_sidebar')) {
// Header: Phone Number
register_sidebar(array(
'name' => 'Phone Number',
'id' => 'phone-number',
'description' => 'Widgetized area for the phone number in the header.',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
));
// Header: Banner
register_sidebar(array(
'name' => 'Banner',
'id' => 'banner',
'description' => 'Widgetized area for the Nivo Slider banner header.',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
));
// Sidebar: Social Links
register_sidebar(array(
'name' => 'Social Links',
'id' => 'social-links',
'description' => 'Widgetized area for the social links icons in the sidebar.',
'before_widget' => '<section id="social-icons">',
'after_widget' => '</section>',
'before_title' => '',
'after_title' => ''
));
// Sidebar: Sub Menu (Navigation)
register_sidebar(array(
'name' => 'Sub Menu',
'id' => 'sub-navigation',
'description' => 'Widgetized area for the Gecka Sub Menu in the sidebar.',
'before_widget' => '<section id="sub-nav">',
'after_widget' => '</section>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
// Sidebar: Call-to-action Buttons
register_sidebar(array(
'name' => 'Call to action buttons',
'id' => 'calls-to-action',
'description' => 'Widgetized area for the big call-to-action buttons in the sidebar.',
'before_widget' => '<nav class="calls-to-action">',
'after_widget' => '</nav>',
'before_title' => '',
'after_title' => ''
));
// Sidebar: Balloon Programme
register_sidebar(array(
'name' => 'Programme',
'id' => 'balloon-programme',
'description' => 'Widgetized area for the ballooning programme in the sidebar.',
'before_widget' => '<section class="balloon-programme">',
'after_widget' => '</section>',
'before_title' => '',
'after_title' => ''
));
// Sidebar: Banner Ads
register_sidebar(array(
'name' => 'Banner Ads',
'id' => 'banner-ads',
'description' => 'Widgetized area for banner ads in the sidebar.',
'before_widget' => '<section class="ads">',
'after_widget' => '</section>',
'before_title' => '',
'after_title' => ''
));
// Sidebar: Featured Accommodation
register_sidebar(array(
'name' => 'Featured Accommodation',
'id' => 'featured-accommodation',
'description' => 'Widgetized area for the featured accommodation in the sidebar.',
'before_widget' => '<section class="featured-accommodation">',
'after_widget' => '</section>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
// Footer: Copyright
register_sidebar(array(
'name' => 'Copyright Notice',
'id' => 'copyright',
'description' => 'Widgetized area for the copyright notice in the footer.',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
));
// Footer: Contact Details
register_sidebar(array(
'name' => 'Contact Details',
'id' => 'contact-details',
'description' => 'Widgetized area for the contact details in the footer.',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
));
// Footer: Blogroll Links
register_sidebar(array(
'name' => 'Footer Links',
'id' => 'footer-links',
'description' => 'Widgetized area for the blogroll links in the footer.',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<p class="hidden">',
'after_title' => '</p>'
));
// Homepage: Gate Gallery
register_sidebar(array(
'name' => 'Gate Gallery',
'id' => 'gate-gallery',
'description' => 'Widgetized area for the gallery gate on the homepage.',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
// Homepage: Gate Experience
register_sidebar(array(
'name' => 'Gate Experience',
'id' => 'gate-experience',
'description' => 'Widgetized area for the experience gate on the homepage.',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h2>',
'after_title' => '</h2>'
));
// Homepage: Gate Video
register_sidebar(array(
'name' => 'Gate Video',
'id' => 'gate-video',
'description' => 'Widgetized area for the Youtube video gate on the homepage.',
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
// Homepage: Accreditation Links (Sidebar)
register_sidebar(array(
'name' => 'Accreditation Links',
'id' => 'accreditation-links',
'description' => 'Widgetized area for the accreditation links in the homepage sidebar.',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
));
// Contact Us: Office Contacts & Snail-mail (Sidebar)
register_sidebar(array(
'name' => 'Office Contacts & Snail-mail',
'id' => 'office-contacts',
'description' => 'Widgetized area for the office contact details and snail-mail address in the contact us sidebar.',
'before_widget' => '<section class="office-contacts">',
'after_widget' => '</section>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
}
// resgiter custom post types
// resgiter testimonials post type
add_action( 'init', 'register_cpt_testimonials' );
function register_cpt_testimonials() {
$labels = array(
'name' => _x( 'Testimonials', 'testimonials' ),
'singular_name' => _x( 'Testimonial', 'testimonials' ),
'add_new' => _x( 'Add New', 'testimonials' ),
'add_new_item' => _x( 'Add New Testimonial', 'testimonials' ),
'edit_item' => _x( 'Edit Testimonial', 'testimonials' ),
'new_item' => _x( 'New Testimonial', 'testimonials' ),
'view_item' => _x( 'View Testimonial', 'testimonials' ),
'search_items' => _x( 'Search Testimonials', 'testimonials' ),
'not_found' => _x( 'No testimonials found', 'testimonials' ),
'not_found_in_trash' => _x( 'No testimonials found in Trash', 'testimonials' ),
'parent_item_colon' => _x( 'Parent Testimonial:', 'testimonials' ),
'menu_name' => _x( 'Testimonials', 'testimonials' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'description' => 'This is the section where you input customer testimonials. Please date-stamp the post by the day on which the customer flew.',
'supports' => array( 'title', 'editor', 'excerpt', 'comments' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => array(
'slug' => 'balloon-experience/testimonials',
'with_front' => false,
'feeds' => false,
'pages' => true
),
'capability_type' => 'post'
);
register_post_type( 'testimonials', $args );
}
// resgiter packages (prices) post type
add_action( 'init', 'register_cpt_packages' );
function register_cpt_packages() {
$labels = array(
'name' => _x( 'Packages', 'packages' ),
'singular_name' => _x( 'Package', 'packages' ),
'add_new' => _x( 'Add New', 'packages' ),
'add_new_item' => _x( 'Add New Package', 'packages' ),
'edit_item' => _x( 'Edit Package', 'packages' ),
'new_item' => _x( 'New Package', 'packages' ),
'view_item' => _x( 'View Package', 'packages' ),
'search_items' => _x( 'Search Packages', 'packages' ),
'not_found' => _x( 'No packages found', 'packages' ),
'not_found_in_trash' => _x( 'No packages found in Trash', 'packages' ),
'parent_item_colon' => _x( 'Parent Package:', 'packages' ),
'menu_name' => _x( 'Packages', 'packages' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'description' => 'This is where you upload your packages and prices.',
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post'
);
register_post_type( 'packages', $args );
}
// limit words outputted in string
function string_limit_words($string, $word_limit)
{
$words = explode(' ', $string, ($word_limit + 1));
if(count($words) > $word_limit) {
array_pop($words);
//add a ... at last article when more than limit word count
echo implode(' ', $words)."..."; } else {
//otherwise
echo implode(' ', $words); }
}
// read more
function new_excerpt_more($more) {
global $post;
return '…';
}
add_filter('excerpt_more', 'new_excerpt_more');
// add feed links
automatic_feed_links();
// load jquery
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"), false);
wp_enqueue_script('jquery');
}
// remove some head items
function removeHeadLinks() {
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
}
add_action('init', 'removeHeadLinks');
remove_action('wp_head', 'wp_generator');
// threaded comments script
function theme_queue_js() {
if (!is_admin()) {
if (is_singular() AND comments_open() AND (get_option('thread_comments') == 1))
wp_enqueue_script('comment-reply');
}
}
add_action('get_header', 'theme_queue_js');
// enqueue gravity form script on homepage
function queue_my_form_scripts() {
gravity_form_enqueue_scripts(1, true);
}
add_action('get_header', 'queue_my_form_scripts');
?>